<?php

class FollowerTable extends Doctrine_Table
{
  public static function getInstance()
  {
    return Doctrine_Core::getTable('Follower');
  }

  public function getFollowerToCredit()
  {
    $q = $this->createQuery('a')
            ->leftJoin('a.Trader t')
            ->where('t.follower_access_id = ?', FollowerAccessTable::NOT_FREE)
            ->andWhere('a.follower_statut_id = ?', FollowerStatutTable::STATUT_BASIC)
            ->andWhere('a.is_suspend = ?', false)
            ->orderBy('a.priority');

    return $q->execute();
  }
}